﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using GoEasy.Resources;
using System.Windows.Media;

namespace GoEasy
{
    
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            init();
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }

        private void init()
        {
            //get themes colors
            System.Windows.Media.Color currentAccentColorHex = (System.Windows.Media.Color)Application.Current.Resources["PhoneAccentColor"];
            Default_Value.ASSENT = new SolidColorBrush(currentAccentColorHex);
            Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];

            if (v == System.Windows.Visibility.Visible)
            {
                // Is light theme
                Default_Value.BACKGROUND = new SolidColorBrush(Colors.White);

            }
            else
            {
                // Is dark theme
                Default_Value.BACKGROUND = new SolidColorBrush(Colors.Black);
            }
            
            SolidColorBrush IconColor = Default_Value.ASSENT;
            SolidColorBrush BackgroundColor = Default_Value.BACKGROUND;
            btnMaps.Background = IconColor;
            btnCamera.Background = IconColor;
            btnSetting.Background = IconColor;
            btnTaxi.Background = IconColor;
            App_title.Foreground = IconColor;

            LayoutRoot.Background = BackgroundColor;
        }

        private void btnShopping_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Screens/PlaceDetail.xaml", UriKind.Relative));
        }

        private void btnCamera_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Screens/CameraDetail.xaml", UriKind.Relative));
        }
    }
}